package com.ourteam.product.api;

import org.apache.commons.lang.StringUtils;

import com.ourteam.frame.web.AbstractSearchModel;
import com.ourteam.product.ui.dao.ProductUIPageTemplateDAOQueryBean;
import com.ourteam.product.ui.domain.ProductUIPageTemplateBean;

public class ProductUIPageTemplateSearchModel extends AbstractSearchModel<ProductUIPageTemplateDAOQueryBean> {

	private String templateName;

	public String getTemplateName() {
		return templateName;
	}

	public void setTemplateName(String templateName) {
		this.templateName = templateName;
	}

	@Override
	public String getMappedDAOField(String aProperty) {
		return ProductUIPageTemplateBean.getMappedDAOField(aProperty);
	}

	@Override
	protected void doBuildQueryBean(ProductUIPageTemplateDAOQueryBean queryBean) throws Exception {

		ProductUIPageTemplateDAOQueryBean.Criteria criteria = queryBean.createCriteria();

		if (StringUtils.isNotBlank(templateName)) {
			criteria.andTemplateNameLike(templateName);
		}

	}

}
